home *** CD-ROM | disk | FTP | other *** search
- property ancestor, pkCategoryField, pkSelectionBkgnd, pkSelectionField, pkFreeFindBkgnd, pkFreeFindText, pkFreeFindEnter, pBankNumber, pPopupMode, pIsComplete
-
- on getBankNumber me
- return pBankNumber
- end
-
- on getPopupMode me
- return pPopupMode
- end
-
- on isComplete me
- return pIsComplete
- end
-
- on setComplete me, isComplete
- pIsComplete = isComplete
- end
-
- on new me, channelList, bankNumber, descendant
- if objectp(descendant) then
- ancestor = new(script("auto popup menu"), channelList, descendant)
- else
- ancestor = new(script("auto popup menu"), channelList, me)
- end if
- disable(ancestor)
- pkCategoryField = 39
- pkSelectionBkgnd = 41
- pkSelectionField = 42
- pkFreeFindBkgnd = 44
- pkFreeFindText = 45
- pkFreeFindEnter = 46
- pPopupMode = #category
- pBankNumber = bankNumber
- pIsComplete = 0
- return me
- end
-
- on Inscope me
- Inscope(ancestor)
- if isdisabled(me) then
- disable(me)
- else
- enable(me)
- end if
- end
-
- on enable me
- enabledMenu = the number of member "selection menu enabled"
- set the memberNum of sprite the pBaseChannel of me to enabledMenu
- enable(ancestor)
- end
-
- on disable me
- disabledMenu = the number of member "selection menu disabled"
- set the memberNum of sprite the pBaseChannel of me to disabledMenu
- disable(ancestor)
- end
-
- on clear me
- pIsComplete = 0
- disable(me)
- clear(ancestor)
- end
-
- on clone me, srcPopupObj
- pPopupMode = getPopupMode(srcPopupObj)
- pIsComplete = isComplete(srcPopupObj)
- clone(ancestor, srcPopupObj)
- end
-
- on setType me, menuType
- clear(me)
- case menuType of
- 1:
- pPopupMode = #category
- menuText = the text of field "category translation"
- put menuText into field the memberNum of sprite pkCategoryField
- 2:
- pPopupMode = #timePeriod
- menuText = the text of field "timePeriod translation"
- put menuText into field the memberNum of sprite pkSelectionField
- 3:
- pPopupMode = #freeFind
- setText(me, " ")
- setSelection(me, 0)
- end case
- end
-
- on expand me
- global gSearchObj
- baseSpriteRect = the rect of sprite me.pBaseChannel
- baseSpriteLoc = point(baseSpriteRect.left, baseSpriteRect.top)
- case pPopupMode of
- #category:
- set the loc of sprite pkCategoryField to baseSpriteLoc
- #timePeriod:
- offsetReg = member(the memberNum of sprite pkSelectionBkgnd).regPoint
- offset = baseSpriteLoc - the loc of sprite pkSelectionBkgnd + offsetReg
- set the loc of sprite pkSelectionBkgnd to the loc of sprite pkSelectionBkgnd + offset
- set the loc of sprite pkSelectionField to the loc of sprite pkSelectionField + offset
- #freeFind:
- put getText(me) into field the memberNum of sprite pkFreeFindText
- offset = baseSpriteLoc - the loc of sprite pkFreeFindBkgnd
- sprite(pkFreeFindText).visible = 0
- set the loc of sprite pkFreeFindBkgnd to the loc of sprite pkFreeFindBkgnd + offset
- set the loc of sprite pkFreeFindText to the loc of sprite pkFreeFindText + offset
- set the loc of sprite pkFreeFindEnter to the loc of sprite pkFreeFindEnter + offset
- sprite(pkFreeFindText).visible = 1
- updateStage()
- end case
- me.pIsPopped = 1
- setPoppedMenu(getMenuBankObj(gSearchObj), me)
- updateStage()
- end
-
- on contract me
- global gSearchObj
- if not pIsComplete then
- disable(me)
- end if
- offset = -9999
- case pPopupMode of
- #category:
- set the loc of sprite pkCategoryField to point(offset, offset)
- popupMember = the memberNum of sprite pkCategoryField
- member(popupMember).color = color(#paletteIndex, 255)
- #timePeriod:
- set the loc of sprite pkSelectionBkgnd to the loc of sprite pkSelectionBkgnd + offset
- set the loc of sprite pkSelectionField to the loc of sprite pkSelectionField + offset
- popupMember = the memberNum of sprite pkSelectionField
- member(popupMember).color = color(#paletteIndex, 255)
- member(popupMember).scrollTop = 0
- #freeFind:
- sprite(pkFreeFindText).visible = 0
- set the loc of sprite pkFreeFindBkgnd to the loc of sprite pkFreeFindBkgnd + offset
- set the loc of sprite pkFreeFindText to the loc of sprite pkFreeFindText + offset
- set the loc of sprite pkFreeFindEnter to the loc of sprite pkFreeFindEnter + offset
- sprite(pkFreeFindText).visible = 1
- end case
- me.pIsPopped = 0
- setPoppedMenu(getMenuBankObj(gSearchObj), 0)
- updateStage()
- end
-
- on mouseUp me
- global gSearchObj
- if not me.pIsDisabled then
- if not me.pIsPopped then
- poppedMenu = getPoppedMenu(getMenuBankObj(gSearchObj))
- if objectp(poppedMenu) then
- contract(poppedMenu)
- end if
- expand(me)
- else
- performFunction(me)
- end if
- end if
- end
-
- on performFunction me
- case pPopupMode of
- #category:
- mLine = the mouseLine
- if mLine > 0 then
- pIsComplete = 1
- popupMember = the memberNum of sprite pkCategoryField
- setText(me, line mLine of the text of field popupMember)
- setSelection(me, mLine)
- contract(me)
- finalizeSelection(me)
- end if
- #timePeriod:
- mLine = the mouseLine
- if mLine > 0 then
- pIsComplete = 1
- popupMember = the memberNum of sprite pkSelectionField
- setText(me, line mLine of the text of field popupMember)
- setSelection(me, mLine)
- contract(me)
- finalizeSelection(me)
- end if
- #freeFind:
- pIsComplete = 1
- setText(me, the text of field the memberNum of sprite pkFreeFindText)
- setSelection(me, 1)
- contract(me)
- finalizeSelection(me)
- end case
- end
-
- on finalizeSelection me
- global gSearchObj
- menuBankObj = getMenuBankObj(gSearchObj)
- setBankStatus(menuBankObj, pBankNumber, #complete)
- if pBankNumber < 3 then
- if getBankStatus(menuBankObj, pBankNumber + 1) = #hidden then
- addMenuObj = getMenuObj(menuBankObj, pBankNumber + 1, #add)
- showMe(addMenuObj)
- end if
- end if
- end
-